package com.mnotice.message.sender;


import com.mnotice.common.entity.message.Notification;
import com.mnotice.message.config.RabbitMQConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class MessageSender {

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void send(String key, Notification msg) {
        rabbitTemplate.convertAndSend(RabbitMQConfig.ITEM_TOPIC_EXCHANGE, key, msg);
    }
}
